<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Memcache类</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="memcache.examples-overview.html"></a></div>
 <div class="next" style="text-align: right; float: right;"><a href="memcache.add.html">Memcache::add</a></div>
 <div class="up"><a href="book.memcache.html">Memcache</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.memcache" class="reference">

 <h1 class="title">Memcache类</h1>
 

 <div class="partintro"><p class="verinfo">(PECL memcache &gt;= 0.2.0)</p>


  <div class="section" id="memcache.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    表示连接到一个服务器组的连接。
   </p>
  </div>


  <div class="section" id="memcache.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">Memcache</strong>
     </span>
     {</div>

    
    <div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.add.html" class="methodname">add</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$var</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flag</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$expire</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.addserver.html" class="methodname">addServer</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code><span class="initializer"> = 11211</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$persistent</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$weight</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$retry_interval</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$status</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.callback" class="type callback">callback</a></span> <code class="parameter">$failure_callback</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeoutms</code></span>
  ]]]]]]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.close.html" class="methodname">close</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.connect.html" class="methodname">connect</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">int</span><span class="methodname"><a href="memcache.decrement.html" class="methodname">decrement</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$value</code><span class="initializer"> = 1</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.delete.html" class="methodname">delete</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code><span class="initializer"> = 0</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.flush.html" class="methodname">flush</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="memcache.get.html" class="methodname">get</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">array</span><span class="methodname"><a href="memcache.getextendedstats.html" class="methodname">getExtendedStats</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$type</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$slabid</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$limit</code><span class="initializer"> = 100</span></span>
  ]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">int</span><span class="methodname"><a href="memcache.getserverstatus.html" class="methodname">getServerStatus</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code><span class="initializer"> = 11211</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">array</span><span class="methodname"><a href="memcache.getstats.html" class="methodname">getStats</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$type</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$slabid</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$limit</code><span class="initializer"> = 100</span></span>
  ]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">string</span><span class="methodname"><a href="memcache.getversion.html" class="methodname">getVersion</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="type">int</span><span class="methodname"><a href="memcache.increment.html" class="methodname">increment</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$value</code><span class="initializer"> = 1</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">mixed</span><span class="methodname"><a href="memcache.pconnect.html" class="methodname">pconnect</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.replace.html" class="methodname">replace</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$var</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flag</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$expire</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.set.html" class="methodname">set</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$var</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flag</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$expire</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.setcompressthreshold.html" class="methodname">setCompressThreshold</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$threshold</code></span>
   [, <span class="methodparam"><span class="type">float</span> <code class="parameter">$min_savings</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="type">bool</span><span class="methodname"><a href="memcache.setserverparams.html" class="methodname">setServerParams</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code><span class="initializer"> = 11211</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$retry_interval</code><span class="initializer"> = false</span></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$status</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.callback" class="type callback">callback</a></span> <code class="parameter">$failure_callback</code></span>
  ]]]]] )</div>

   }</div>


  </div>
  
 </div>

 

























































































































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="memcache.add.html">Memcache::add</a> — 增加一个条目到缓存服务器</li><li><a href="memcache.addserver.html">Memcache::addServer</a> — 向连接池中添加一个memcache服务器</li><li><a href="memcache.close.html">Memcache::close</a> — 关闭memcache连接</li><li><a href="memcache.connect.html">Memcache::connect</a> — 打开一个memcached服务端连接</li><li><a href="memcache.decrement.html">Memcache::decrement</a> — 减小元素的值</li><li><a href="memcache.delete.html">Memcache::delete</a> — 从服务端删除一个元素</li><li><a href="memcache.flush.html">Memcache::flush</a> — 清洗（删除）已经存储的所有的元素</li><li><a href="memcache.get.html">Memcache::get</a> — 从服务端检回一个元素</li><li><a href="memcache.getextendedstats.html">Memcache::getExtendedStats</a> — 缓存服务器池中所有服务器统计信息</li><li><a href="memcache.getserverstatus.html">Memcache::getServerStatus</a> — 用于获取一个服务器的在线/离线状态</li><li><a href="memcache.getstats.html">Memcache::getStats</a> — 获取服务器统计信息</li><li><a href="memcache.getversion.html">Memcache::getVersion</a> — 返回服务器版本信息</li><li><a href="memcache.increment.html">Memcache::increment</a> — 增加一个元素的值</li><li><a href="memcache.pconnect.html">Memcache::pconnect</a> — 打开一个到服务器的持久化连接</li><li><a href="memcache.replace.html">Memcache::replace</a> — 替换已经存在的元素的值</li><li><a href="memcache.set.html">Memcache::set</a> — Store data at the server</li><li><a href="memcache.setcompressthreshold.html">Memcache::setCompressThreshold</a> — 开启大值自动压缩</li><li><a href="memcache.setserverparams.html">Memcache::setServerParams</a> — 运行时修改服务器参数和状态</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="memcache.examples-overview.html"></a></div>
 <div class="next" style="text-align: right; float: right;"><a href="memcache.add.html">Memcache::add</a></div>
 <div class="up"><a href="book.memcache.html">Memcache</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
